package com.luiz.aero.android.data;

import android.location.Location;

public class Position {

	private Location location;
	private int azimuth;
	private int roll;
	private int pitch;
	private int accelerationX;
	private int accelerationY;
	private int accelerationZ;
	private int[] servosPosition;

	public Position(Location location, int azimuth, int roll, int pitch,
			int accelerationX, int accelerationY, int accelerationZ,
			int[] servosPosition) {
		super();
		this.location = location;
		this.azimuth = azimuth;
		this.roll = roll;
		this.pitch = pitch;
		this.accelerationX = accelerationX;
		this.accelerationY = accelerationY;
		this.accelerationZ = accelerationZ;
		this.servosPosition = servosPosition;
	}
	
	public Position() {
		super();
		this.location = StaticPositionData.location;
		this.azimuth = StaticPositionData.azimuth;
		this.roll = StaticPositionData.roll;
		this.pitch = StaticPositionData.pitch;
		this.accelerationX = StaticPositionData.accelerationX;
		this.accelerationY = StaticPositionData.accelerationY;
		this.accelerationZ = StaticPositionData.accelerationZ;
		this.servosPosition = StaticPositionData.servosPosition;
	}
	
	

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}

	public int getAzimuth() {
		return azimuth;
	}

	public void setAzimuth(int azimute) {
		this.azimuth = azimute;
	}

	public int getRoll() {
		return roll;
	}

	public void setRoll(int roll) {
		this.roll = roll;
	}

	public int getPitch() {
		return pitch;
	}

	public void setPitch(int pich) {
		this.pitch = pich;
	}

	public int getAccelerationX() {
		return accelerationX;
	}

	public void setAccelerationX(int accelerationX) {
		this.accelerationX = accelerationX;
	}

	public int getAccelerationY() {
		return accelerationY;
	}

	public void setAccelerationY(int accelerationY) {
		this.accelerationY = accelerationY;
	}

	public int getAccelerationZ() {
		return accelerationZ;
	}

	public void setAccelerationZ(int accelerationZ) {
		this.accelerationZ = accelerationZ;
	}

	public int[] getServosPosition() {
		return servosPosition;
	}

	public void setServosPosition(int[] servosPosition) {
		this.servosPosition = servosPosition;
	}

	@Override
	public boolean equals(Object o) {
		Position pos = (Position) o;
		if(this.servosPosition.equals(pos.getServosPosition())){
			if(this.getLocation().equals(pos.getLocation())){
				return true;
			}
		}
		return false;
	}
	
	@Override
	public String toString() {
		String result = "" + this.getLocation().toString() + ",mAzimuth:" + this.getAzimuth() +
				",mPitch:" + this.getPitch() + ",mRoll:" + this.getRoll() + ",mAcceleration:,X:" + 
				this.getAccelerationX() + ",Y:" + this.getAccelerationY() + ",Z:" + this.getAccelerationZ();
				//+ "[SERVOS]" + this.getServosPosition().toString();
		result = result.replaceAll("Location\\[", "");
		result = result.replaceAll(",", ";\n");
		return result;
	}

}
